package com.ls.controller.activity;

import com.ls.controller.activity.model.AddActivityModel;
import com.ls.controller.activity.model.EditActivityModel;
import com.ls.controller.activity.model.updateStatusModel;
import com.ls.service.IActivityService;
import com.ls.utils.ResultData;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 活动 前端控制器
 * </p>
 *
 * @author pengyu
 * @since 2024-10-12
 */
@Slf4j
@Api(value = "PC活动相关接口", tags = "PC活动相关接口")
@RestController
@RequiredArgsConstructor
@RequestMapping("/activity")
public class ActivityController {
    private final IActivityService service;
    /** 活动列表 */
    @GetMapping("pageList")
    public ResultData pageList() {
        return service.pageList();
    }
    /** 新增活动 */
    @PostMapping("add")
    public ResultData add(@Valid @RequestBody AddActivityModel model) {
        return service.add(model);
    }
    /** 编辑活动 */
    @PostMapping("edit")
    public ResultData edit(@Valid @RequestBody EditActivityModel model) {
        return service.edit(model);
    }
    /**修改活动启用状态*/
    @PostMapping("updateStatus")
    public ResultData updateStatus(@Valid @RequestBody updateStatusModel model) {
        return service.updateStatus(model);
    }
}
